/**
 * Created by ZhaoJinBing on 2017/8/4.
 */
define(['jquery', 'js/common/uuid', 'easyui'], function ($, uuid) {
    var create = function (setting) {
        if (!$.isPlainObject(setting)) {
            $.error('setting 不能为空')
        }
        var id = setting.id ? setting.id : uuid.uuid();
        var style = setting.style;
        var jqObj = $('<div id="'+id+'" style="'+style+'"></div>');
        jqObj.dialog(setting);
        jqObj.destroy = function () {
            destroy(jqObj);
        };
        return jqObj;
    };

    var destroy = function (target) {
        target.dialog('close');
        target == null;
    };

    return {
        create: create
    }
});
